﻿
namespace MagicWatering.Scheduler.Controller
{
    using System;
    using System.Collections.Generic;
    using MagicWatering.Interfaces;

    public class DummyController: IWateringController
    {
        private List<CallInfo> m_calledChannels;

        public IList<CallInfo> CalledInfoList
        {
            get { return m_calledChannels; }
        }
        public DummyController()
        {
            m_calledChannels = new List<CallInfo>();
        }
        public bool StartCommunication()
        {
            return true;
        }

        public bool StopCommunication()
        {
            return true;
        }

        public bool SetChannelState(int channelId, bool value)
        {
            m_calledChannels.Add(new CallInfo
                                     {
                                         ChannelId = channelId, 
                                         Value = value, 
                                         CalledDateTime = DateTime.Now
                                     });
            return true;
        }

        public bool GetChannelState(int channelId, out bool value)
        {
            value = true;
            return true;
        }

        public void ChangeControllerIp(string newIpAddress)
        {
        }

        public int LastError
        {
            get { throw new NotImplementedException(); }
        }

        public class CallInfo
        {
            public int ChannelId
            {
                get;
                set;
            }
            public bool Value
            {
                get;
                set;
            }
            public DateTime CalledDateTime
            {
                get;
                set;
            }
        }
    }
}
